[-*Smarty*-]
[-* we want to include out stylesheet for this view*-]
[-include file="$TPL_NAME/views/header.html"-]
[-fetch file="$TPL_STYLE_PATH/search.css" assign="css"-]
[-eval var=$css-]
<!-- main navigation -->
[-*Load the Language Definitions*-]
[-config_load file="lang.$USER_LANG"-]
[-*Main Navigation*-]
[-*include file="$TPL_NAME/views/global/small_navigation.html"*-]
<table width="100%" border="0" cellpadding="0" cellspacing="0" style="border: 1px solid black;"><tr><td>
<form name="search" action="[-$FORM_ACTION-]" method="POST" onsubmit="return top.restoreSession()">
<br />
[-#_PC_SEARCH_KEYWORDS#-]: <input type="text" name="pc_keywords" value="" />
<select name="pc_keywords_andor">
    <option value="AND">[-#_PC_SEARCH_AND#-]</option>
    <option value="OR">[-#_PC_SEARCH_OR#-]</option>
</select>
[-#_PC_SEARCH_IN#-]:
<select name="pc_category">
    <option value="">[-#_PC_SEARCH_ANY_CATEGORY#-]</option>
    [-$CATEGORY_OPTIONS-]
</select>
[-if $USE_TOPICS-]
<select name="pc_topic">
    <option value="">[-#_PC_SEARCH_ANY_TOPIC#-]</option>
    [-$TOPIC_OPTIONS-]
</select>
[-/if-]
<input type="submit" name="submit" value="[-#_PC_SUBMIT#-]" />
</form>
</td></tr></table>

[-if $SEARCH_PERFORMED-]
<br />
[-*We should have results and should display them*-]
[-counter start=0 print=false assign="eventCount"-]
[-pc_sort_events var="S_EVENTS" sort="category" order="asc" value=$A_EVENTS-]
[-foreach name=dates item=date key=cdate from=$S_EVENTS-]
    [-if $date|@count > 0-]
    [-assign var="dayname" value=$cdate|date_format:"%w"-]
    [-assign var="day" value=$cdate|date_format:"%d"|string_format:"%1d"-]
    [-assign var="month" value=$cdate|date_format:"%m"|string_format:"%1d"-]
    [-assign var="month" value=$month-1-]
    [-assign var="year" value=$cdate|date_format:"%Y"|string_format:"%4d"-]
    <table width="100%" border="0" cellpadding="5" cellspacing="0" class="dayheader">
        <tr>
            <td width="100%">
                <a href="[-pc_url action=day date=$cdate-]" onclick="top.restoreSession()">
            [-if $USE_INT_DATES eq true-]
                [-pc_date_format date=$cdate format="%A, %d %B %Y"-]
            [-else-]    
                [-pc_date_format date=$cdate format="%A, %B %d %Y"-]
            [-/if-]</a>
            </td>
        </tr>
    </table>
    <table width="100%" border="0" cellpadding="5" cellspacing="0" class="calcontainer">
        <tr>
            <td width="100%" class="eventslist">
                [-assign var="oldCat" value=""-]
                [-foreach name=events item=event from=$date-]
                    [-counter-]
                    [-assign var="cCat" value=$event.catname-]
                    [-if $oldCat != $cCat-]
                    [-if $smarty.foreach.events.first != true-]
                        </div>
                    [-/if-]
                    <div width="100%" style="padding: 2px; background-color: [-$event.catcolor-];">
                        [-$event.catname-]
                    </div>
                    <div width="100%" style="padding: 2px; border:solid 1px [-$event.catcolor-];">
                    [-/if-]
                    [-if $24HOUR_TIME-]
                        [-assign var="timestamp" value=$event.startTime|date_format:"%H:%M"-]
                    [-else-]
                        [-assign var="timestamp" value=$event.startTime|date_format:"%I:%M %p"-]
                    [-/if-]
                    [-if $event.alldayevent != true-]
                        [-$timestamp-]
                    [-/if-]
                    <a href="[-pc_url action=detail eid=$event.eid date=$cdate-]" onclick="top.restoreSession()"
                    [-pc_popup delay="500"
                               bgcolor=$event.catcolor
                               caption=$event.title
                               text=$event.hometext-]>
                    [-$event.title|strip_tags-]</a>
                    [-if $event.alldayevent != true-]
                        ([-$event.duration_hours-]:[-$event.duration_minutes-])
                    [-/if-]
                    [-include file="$TPL_NAME/user/patient_line.html" event=$event show_patient=true show_icons=true show_provider=true-]
                    <br />
                    [-assign var="oldCat" value=$event.catname-]
                    [-if $smarty.foreach.events.last-]
                        [-* we need to close out the <div> tag *-]
                        </div>
                    [-/if-]
                [-/foreach-]
            </td>
        </tr>
    </table>
    [-/if-]
[-/foreach-]
[-if $eventCount == 0-]
[-#_PC_SEARCH_NO_RESULTS#-]
[-/if-]
[-/if-]
[-*include file="$TPL_NAME/views/footer.html"*-]

